class MaterialApoiosController < ApplicationController
 before_filter :authAluno, :only => [:show]
 layout "admin"
  # GET /material_apoios
  # GET /material_apoios.xml
  def index
    @material_apoios = MaterialApoio.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @material_apoios }
    end
  end

  # GET /material_apoios/1
  # GET /material_apoios/1.xml
  def show
    @material_apoio = MaterialApoio.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @material_apoio }
    end
  end

  # GET /material_apoios/new
  # GET /material_apoios/new.xml
  def new
    @material_apoio = MaterialApoio.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @material_apoio }
    end
  end

  # GET /material_apoios/1/edit
  def edit
    @material_apoio = MaterialApoio.find(params[:id])
  end

  # POST /material_apoios
  # POST /material_apoios.xml
  def create
    @material_apoio = MaterialApoio.new(params[:material_apoio])

    respond_to do |format|
      if @material_apoio.save
        flash[:notice] = 'MaterialApoio was successfully created.'
        format.html { redirect_to(@material_apoio) }
        format.xml  { render :xml => @material_apoio, :status => :created, :location => @material_apoio }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @material_apoio.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /material_apoios/1
  # PUT /material_apoios/1.xml
  def update
    @material_apoio = MaterialApoio.find(params[:id])

    respond_to do |format|
      if @material_apoio.update_attributes(params[:material_apoio])
        flash[:notice] = 'MaterialApoio was successfully updated.'
        format.html { redirect_to(@material_apoio) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @material_apoio.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /material_apoios/1
  # DELETE /material_apoios/1.xml
  def destroy
    @material_apoio = MaterialApoio.find(params[:id])
    @material_apoio.destroy

    respond_to do |format|
      format.html { redirect_to(material_apoios_url) }
      format.xml  { head :ok }
    end
  end
end
